<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="client_id" content="110866011"/>
    <meta name="redirect_uri" content="http://demo.html"/>
    <meta name="scope"
          content="openid+profile+email+https://www.huawei.com/auth/drive+https://www.huawei.com/auth/drive.appdata"/>
    <title>登录页面</title>
    <style>
        body {
            font-family: "Microsoft YaHei", sans-serif;
            background-color: #f2f2f2;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }
        .login-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            margin-bottom: 5px;
        }
        .form-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box; /* ensures padding doesn't affect width */
        }
        .form-group button {
            width: 100%;
            padding: 10px;
            border: none;
            background-color: #5cb85c;
            color: white;
            border-radius: 4px;
            cursor: pointer;
        }
        .form-group button:hover {
            background-color: #4cae4c;
        }
        .right-aligned-text {
            text-align: right;
        }

    </style>
</head>
<body>
<div class="login-container">
    <h2>登录</h2>
    <form action="/login" method="post">
        <div class="form-group">
            <label for="username">用户名:</label>
            <input type="text" id="username" name="username" required>
        </div>
        <div class="form-group">
            <label for="password">密码:</label>
            <input type="password" id="password" name="password" required>
        </div>
        <div class="form-group">
            <button type="submit">登录</button>
        </div>
        <div class="right-aligned-text">
            <a onclick=redirect()>华为账号登录</a>
        </div>
    </form>
</div>
</body>
<script type="text/javascript">
         var client_id ='',redirect_uri='',scope='';
         for(var metas=document.getElementsByTagName("meta"),i=0;i<metas.length;++i){
                   switch(metas[i].name) {
              case 'client_id':
                 client_id = metas[i].content;
                 break;
              case 'redirect_uri':
                  redirect_uri = metas[i].content;
                 break;
              case 'scope':
                 scope = metas[i].content;
                 break;
              default:break
                   }
         }
         var redirectUrl='https://oauth-login.cloud.huawei.com/oauth2/v3/authorize?'+
 'response_type=code&access_type=offline&state=state_parameter_passthrough_value&client_id='+client_id
 +'&redirect_uri='+ redirect_uri +'&scope='+ scope;

function redirect() {
         window.location.href=redirectUrl;
}



</script>
</html>
